﻿
using System;
using System.Collections.Generic;
using System.Collections;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using System.Drawing;
using System.Xml;
using DevComponents.DotNetBar;
using Shine.ManageUser;
using System.IO;
using System.ComponentModel;
using ILog = log4net.ILog;
using log4net;


namespace Shine.Framework
{
    public class BarManagerClass : IBarManager
    {
        private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

     
        private RibbonControl m_RibbonControl;
        ICommandPoolEx m_CommandPoolEx = null;
        ContextMenuStrip map_ContextMenuStrip = new ContextMenuStrip();
        ContextMenuStrip page_ContextMenuStrip = new ContextMenuStrip();
        ContextMenuStrip vertex_ContextMenuStrip = new ContextMenuStrip();
        ContextMenuStrip sketch_ContextMenuStrip = new ContextMenuStrip();
        ContextMenuStrip edit_ContextMenuStrip = new ContextMenuStrip();
        public event OnHideDockWindowEventHandler OnHideWindow;
        public event OnItemClickEventHandler OnItemClickEvent;
        public event OnAddBarEventHandler OnAddBarEvent;
        int flag = 0;
        int index = 10;
        #region Attribute
        public ICommandPoolEx CommandPoolEx
        {
            get
            {
                return this.m_CommandPoolEx;
            }
            set
            {
                m_CommandPoolEx = value;
            }
        }
        #endregion

        public BarManagerClass( )
        {
            m_CommandPoolEx = new CommandPoolExClass();
         

        }

        public void CreateBar(Control container, List<IPrivilegeGroup> groups)
        {

            m_RibbonControl= container as RibbonControl;
            if (m_RibbonControl == null) return;
            m_RibbonControl.Parent.SuspendLayout();
            m_RibbonControl.SuspendLayout();      
          
            foreach (IPrivilegeGroup group in groups)
            {
                if (!group.Enable)
                {
                    continue;
                }
                else
                {
                    try
                    {
                        switch (group.Text)
                        {
                            case "地图右键菜单":
                                map_ContextMenuStrip.Name = "MapCustomMenu";
                                ConstructContextMenu(map_ContextMenuStrip.Items, group);
                                break;
                            case "布局右键菜单":
                                map_ContextMenuStrip.Name = "PageCustomMenu";
                                ConstructContextMenu(page_ContextMenuStrip.Items, group);
                                break;
                            case "节点右键菜单":
                                vertex_ContextMenuStrip.Name = "vertexContextMenuStrip";
                                ConstructContextMenu(vertex_ContextMenuStrip.Items, group);
                                break;
                            case "草图右键菜单":
                                sketch_ContextMenuStrip.Name = "sketchContextMenuStrip";
                                ConstructContextMenu(sketch_ContextMenuStrip.Items, group);
                                break;
                            case "选中右键菜单":
                                this.edit_ContextMenuStrip.Name = "editContextMenuStrip";
                                ConstructContextMenu(edit_ContextMenuStrip.Items, group);
                                break;
                            default:
                                AddMenuBar(group);
                                break;
                        }
                    }
                    catch (Exception ex)
                    {                       
                        log.Error(group.TypeName);
                        log.Error(ex.Message);                       
                    }
                }
            }

          
            m_RibbonControl.ResumeLayout(false);
            m_RibbonControl.PerformLayout();

            //foreach (RibbonPanel panel in m_RibbonControl.Controls) 
            //{
            //    panel.ResumeLayout(false);
            //}
            for (int i = 0; i < m_RibbonControl.Controls.Count; i++)
            {
                if (m_RibbonControl.Controls[i] is RibbonPanel)
                {
                    (m_RibbonControl.Controls[i] as RibbonPanel).ResumeLayout(false);
                }
            }
            m_RibbonControl.Parent.ResumeLayout(false );
        }       

        private void ConstructContextMenu(ToolStripItemCollection pSubItems, IPrivilegeGroup pGroup)
        {
            List<IPrivilegeElement> pElements = pGroup.GetChilds();
            foreach (IPrivilegeElement element in pElements)
            {
                if (element.Enable && element is IPrivilegeGroup)
                {

                    IPrivilegeGroup pGroup2 = element as IPrivilegeGroup;
                    if (pGroup2.GetChilds().Count > 0)
                    {
                        if (element.BeginGroup)
                        {
                            ToolStripSeparator pSeperator = new ToolStripSeparator();
                            pSubItems.Add(pSeperator);
                        }
                        ToolStripMenuItem pMenu = new ToolStripMenuItem(pGroup2.Text);
                        pSubItems.Add(pMenu);
                        ConstructContextMenu(pMenu.DropDownItems, pGroup2);
                    }
                }
                else if (element.Enable && element is IPrivilegeElement)
                {
                    Type elementType = Type.GetType(element.TypeName);
                    if (elementType == null) continue;
                    object elementObj = Activator.CreateInstance(elementType);
                    if (elementObj is ICommand)
                    {
                        ToolStripMenuItem button = CreateToolStripMenuItem(elementObj);
                        button.Text = element.Text;
                        if (element.BeginGroup)
                        {
                            ToolStripSeparator pSeperator = new ToolStripSeparator();
                            pSubItems.Add(pSeperator);
                        }
                        pSubItems.Add(button);
                    }
                }

            }
        }

        private RibbonBar CreateRibbonBar( )
        {
            RibbonBar ribbonBar1 = new RibbonBar();
           // ribbonBar1.SuspendLayout();
            ribbonBar1.AutoOverflowEnabled = true;
            ribbonBar1.BackgroundMouseOverStyle.Class = "";
            ribbonBar1.BackgroundStyle.Class = "";
            ribbonBar1.ContainerControlProcessDialogKey = true;
            ribbonBar1.Dock = System.Windows.Forms.DockStyle.Left;           
            ribbonBar1.Size = new System.Drawing.Size(100, 93);
            ribbonBar1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
            ribbonBar1.TabIndex = 0;          
            ribbonBar1.TitleStyle.Class = "";
            ribbonBar1.TitleStyleMouseOver.Class = "";          
            return ribbonBar1;
        }
        private RibbonPanel CreateRibbonPanel( )
        {
            RibbonPanel ribbonPanel1 = new RibbonPanel();
            ribbonPanel1.SuspendLayout();
            ribbonPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;          
            ribbonPanel1.Dock = System.Windows.Forms.DockStyle.Fill;                 
            ribbonPanel1.Padding = new System.Windows.Forms.Padding(3, 0, 3, 3);
            //ribbonPanel1.Size = new System.Drawing.Size(884, 96);
            ribbonPanel1.Style.Class = "";
            ribbonPanel1.StyleMouseDown.Class = "";
            ribbonPanel1.StyleMouseOver.Class = "";
            ribbonPanel1.TabIndex = 1;          
            return ribbonPanel1;
        }
        private RibbonTabItem CreateRibbonTabItem(string caption)
        {
            RibbonTabItem ribbonTabItem1 = new RibbonTabItem();           
            ribbonTabItem1.Text = caption;        
            return ribbonTabItem1;
        }

        public void AddMenuBar(IPrivilegeGroup group, params object[] container)
        {
            /*
             一级菜单: RibbonTabItem/RibbPanel
             二级菜单: RibbonBar
             三级菜单: ButtonItem ；如果菜单竖排，要加一个垂直ItemContianer，再把ButtonItem放进去
             四级菜单: ButtonItem ( sub)
             五级菜单: ButtonItem ( sub)
             ......
             **/
            if (group.Enable == false) return;
            object parent = null;         
            RibbonBar defaultRibbonBar = null;
            if (container == null || container.Length == 0) //一级菜单
            {
                RibbonPanel panel = CreateRibbonPanel();
                RibbonTabItem item = CreateRibbonTabItem(group.Text);
                item.KeyTips = group.KeyTips;
                item.Panel = panel;
                if (flag == 0)
                {
                    item.Checked = true;
                    flag = 1;
                }
                m_RibbonControl.Controls.Add(panel);
                m_RibbonControl.Items.Add(item);
                parent = panel;
                defaultRibbonBar = CreateRibbonBar();
                defaultRibbonBar.Text = group.Text;
                 
                panel.Controls.Add(defaultRibbonBar);
                defaultRibbonBar.Location = new Point(defaultRibbonBar.Parent.Controls.Count * defaultRibbonBar.Width, 0);                          
            }
            else
            {
                parent = container[0];
            }
            ItemContainer verticalContiner = null;//垂直排列项的容器，仅仅在三级菜单时有用
            List<IPrivilegeElement> privilegeList = group.GetChilds();
      
            foreach (IPrivilegeElement element in privilegeList)
            {
                if (!element.Enable) continue;
                BaseItem bItem = null;
                if (!(element is IPrivilegeGroup))
                {
                    Type elementType = Type.GetType(element.TypeName);
                    if (elementType == null) continue;
                    bItem = PrivilegeElement2BaseItem(element);
                    if (bItem == null) continue;
                }
                if (parent is RibbonPanel) //二级菜单
                {
                    if (element is IPrivilegeGroup)
                    {
                        RibbonPanel panel = parent as RibbonPanel;
                        RibbonBar ribbonBar = CreateRibbonBar();
                        ribbonBar.Text = element.Text;
                        panel.Controls.Add(ribbonBar);
                        ribbonBar.Location = new Point(ribbonBar.Parent.Controls.Count * ribbonBar.Width, 0);
                        AddMenuBar(element as IPrivilegeGroup, ribbonBar);                                            
                    }
                    else
                    {
                        if (element.VerticalShow)
                        {
                            if (verticalContiner == null)
                            {
                                verticalContiner = new ItemContainer();
                                verticalContiner.LayoutOrientation = eOrientation.Vertical;
                                defaultRibbonBar.Items.Add(verticalContiner);
                                verticalContiner.SubItems.Add(bItem);
                            }
                            else
                            {
                                if (verticalContiner.SubItems.Count == 3 || element.BeginGroup)
                                {
                                    verticalContiner.ItemSpacing = verticalContiner.SubItems.Count == 3 ? 2 : 10;
                                    verticalContiner = new ItemContainer();
                                    verticalContiner.LayoutOrientation = eOrientation.Vertical;
                                    defaultRibbonBar.Items.Add(verticalContiner);
                                }
                                verticalContiner.SubItems.Add(bItem);
                            }
                        }
                        else
                        {
                            defaultRibbonBar.Items.Add(bItem);
                        }
                    }
                }
                else if (parent is RibbonBar) //三级菜单
                {
                    if (element is IPrivilegeGroup)
                    {
                        ButtonItem btn = new ButtonItem();
                        btn.Text = element.Text;
                        btn.AutoCollapseOnClick = true;
                        btn.AutoExpandOnClick = true;
                        if (element.VerticalShow)
                        {
                            if (verticalContiner == null)
                            {
                                verticalContiner = new ItemContainer();
                                verticalContiner.LayoutOrientation = eOrientation.Vertical;
                                (parent as RibbonBar).Items.Add(verticalContiner);
                                verticalContiner.SubItems.Add(btn);
                            }
                            else
                            {
                                if (verticalContiner.SubItems.Count == 3 || element.BeginGroup)
                                {
                                    verticalContiner.ItemSpacing = verticalContiner.SubItems.Count == 3 ? 2 : 10;
                                    verticalContiner = new ItemContainer();
                                    verticalContiner.LayoutOrientation = eOrientation.Vertical;
                                    (parent as RibbonBar).Items.Add(verticalContiner);
                                    verticalContiner.SubItems.Add(btn);
                                }
                            }
                        }
                        else
                        {
                            (parent as RibbonBar).Items.Add(btn);
                        }
                        AddMenuBar(element as IPrivilegeGroup, btn);
                    }
                    else
                    {
                        if (element.VerticalShow)
                        {
                            if (verticalContiner == null)
                            {
                                verticalContiner = new ItemContainer();
                                verticalContiner.LayoutOrientation = eOrientation.Vertical;//
                                (parent as RibbonBar).Items.Add(verticalContiner);
                                verticalContiner.SubItems.Add(bItem);
                            }
                            else
                            {
                                if (verticalContiner.SubItems.Count == 3 || element.BeginGroup)
                                {
                                    verticalContiner.ItemSpacing = verticalContiner.SubItems.Count == 3 ? 2 : 10;
                                    verticalContiner = new ItemContainer();
                                    verticalContiner.LayoutOrientation = eOrientation.Vertical;
                                    (parent as RibbonBar).Items.Add(verticalContiner);
                                }
                                verticalContiner.SubItems.Add(bItem);
                            }
                        }
                        else
                        {

                            ((RibbonBar)parent).Items.Add(bItem);
                        }
                    }
                }
                else if (parent is ButtonItem) //四级及以上级菜单
                {
                    if (element is IPrivilegeGroup)
                    {
                        ButtonItem btn = new ButtonItem();
                        btn.Text = element.Text;
                        btn.AutoCollapseOnClick = true;
                        btn.AutoExpandOnClick = true;
                        (parent as ButtonItem).SubItems.Add(btn);
                        AddMenuBar(element as IPrivilegeGroup, btn);
                    }
                    else
                    {
                        if (bItem is ButtonItem)
                        {
                            (bItem as ButtonItem).ImageFixedSize = new Size(18, 18);
                            (bItem as ButtonItem).ImagePosition = DevComponents.DotNetBar.eImagePosition.Left;
                        }
                        ((ButtonItem)parent).SubItems.Add(bItem);
                       
                    }
                }
            }
            if (verticalContiner != null)
            {
                verticalContiner.ItemSpacing = verticalContiner.SubItems.Count == 3 ? 2 : 10;  
            }
                  
            if (defaultRibbonBar != null && defaultRibbonBar.Items.Count == 0)
            {
                
                defaultRibbonBar.Parent.Controls.Remove(defaultRibbonBar);
                
            }        
            if (parent is RibbonBar)
            {
                if ((parent as RibbonBar).Items.Count == 0)
                {

                    (parent as RibbonBar).Parent.Controls.Remove((parent as RibbonBar));
                }            
            }
            //if (parent is RibbonPanel)
            //{
            //    (parent as RibbonPanel).ResumeLayout();
            //}
         
        }
        private BaseItem PrivilegeElement2BaseItem(IPrivilegeElement element)
        {
            if (element.Enable == false) return null;
            if (element is IPrivilegeGroup) return null;
            Type elementType = Type.GetType(element.TypeName);
            if (elementType == null) return null ;
            object elementObj = Activator.CreateInstance(elementType);
            if (elementObj == null) return  null ;
            BaseItem  bItem = CreateBaseItem(elementObj);
            if (bItem is ButtonItem)
            {
                ICommand command = elementObj as ICommand;
                ButtonItem btn = bItem as ButtonItem;
                btn.Text = element.Text;
                btn.ImageFixedSize = element.ImageFixedSize;
                btn.KeyTips = element.KeyTips;
                btn.SubItemsExpandWidth = 14;

                switch (element.ButtonStyle)
                {
                    case Shine.ManageUser.eButtonStyle.ImageAndText:
                        btn.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
                        break;
                    case Shine.ManageUser.eButtonStyle.Image:
                        btn.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.Default;
                        break;
                    case Shine.ManageUser.eButtonStyle.Text:
                        btn.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways;
                        break;
                    default:
                        {
                            btn.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
                            break;
                        }
                }
                switch (element.ImagePosition)
                {
                    case Shine.ManageUser.eImagePosition.Left:
                        btn.ImagePosition = DevComponents.DotNetBar.eImagePosition.Left;
                        break;
                    case Shine.ManageUser.eImagePosition.Right:
                        btn.ImagePosition = DevComponents.DotNetBar.eImagePosition.Right;
                        break;
                    case Shine.ManageUser.eImagePosition.Top:
                        btn.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
                        break;
                    case Shine.ManageUser.eImagePosition.Bottom:
                        btn.ImagePosition = DevComponents.DotNetBar.eImagePosition.Bottom;
                        break;
                }
                if (element.VerticalShow)
                {
                    string imageFile = Application.StartupPath + "\\Images\\18x18\\" + element.NakedText+ ".png";
                    if (System.IO.File.Exists(imageFile))
                    {
                        Image img = Image.FromFile(imageFile);
                        btn.Image = img;
                    }

                    btn.ImageFixedSize = new Size(18, 18);
                    btn.ImagePosition = DevComponents.DotNetBar.eImagePosition.Left;
                }
                else
                {
                    string imageFile = Application.StartupPath + "\\Images\\32x32\\" + element.NakedText + ".png";
                    if (System.IO.File.Exists(imageFile))
                    {
                        Image img = Image.FromFile(imageFile);
                        btn.Image = img;
                    }
                }
              
             
            }
            return bItem;
        }

        private void ReversePrivilegeGroup(IPrivilegeGroup group)
        {
            List<IPrivilegeElement> elements= group.GetChilds();
            int i = 0, j = elements.Count - 1;
            while (i < j & i<elements.Count-1 & j>0)
            {
                while (i < elements.Count - 1)
                {
                    if (elements[i] is IPrivilegeGroup)
                        break;
                    else i++;
                }
                if (i >= elements.Count - 1) break;
                while (j > 0)
                {
                    if (elements[j] is IPrivilegeGroup)
                        break;
                    else j--;
                }
                if (j == 0) break;

                if (i < j)
                {
                    IPrivilegeGroup tmp = elements[i] as IPrivilegeGroup;
                    elements[i] = elements[j];
                    elements[j] = tmp;

                }
                i++;
                j--;
            }
        }

        private ToolStripMenuItem CreateToolStripMenuItem(object obj)
        {
            ToolStripMenuItem tsmi = new ToolStripMenuItem();        
            //tsmi.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
            //tsmi.Text = ((ESRI.ArcGIS.SystemUI.ICommand)obj).Caption;
            //if ((obj as ICommand).Bitmap != 0)
            //{
            //    Bitmap m_bitmap = System.Drawing.Bitmap.FromHbitmap((IntPtr)(obj as ICommand).Bitmap);
            //    m_bitmap.MakeTransparent(m_bitmap.GetPixel(0, 0));
            //    tsmi.Image = m_bitmap;
            //}
            //tsmi.Checked = ((ESRI.ArcGIS.SystemUI.ICommand)obj).Checked;
            //tsmi.Tag = obj;
            //tsmi.Click += new EventHandler(ToolStripMenuItem_Click);       
            return tsmi;
        }

        void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (OnItemClickEvent != null)
            {
                OnItemClickEvent((sender as ToolStripMenuItem).Tag);
            }
        }

        private BaseItem CreateBaseItem(object obj)
        {
            BaseItem baseItem = m_CommandPoolEx.AddCommand(obj);
            if(baseItem !=null )
            baseItem.Click += new EventHandler(baseItem_Click);
            return baseItem;
        }

        void baseItem_Click(object sender, EventArgs e)
        {
            if (OnItemClickEvent != null)
            {
                OnItemClickEvent(m_CommandPoolEx.FindCommand((sender as BaseItem).Name));
            }
        }

        public ICommand FindCommand(string sCommandName)
        {
            return m_CommandPoolEx.FindCommand(sCommandName);
        }

        public void LoadTools(IApplication pApp, string FileName)
        {

        }

        private Assembly GetAssembly(string sAssemblyName)
        {
            return Assembly.Load(sAssemblyName);
        }

        public void SetCustomPopupContextMenu(Control pControl)
        {
            ContextMenuStrip m_ContextMenuStrip = new ContextMenuStrip();
            m_ContextMenuStrip.Name = "MapCustomMenu";
        }

        public void GetContextMenuStrip(IApplication m_Application, int X, int Y)
        {
            //if (((m_Application as IFramework).IsMapCtrlactive))
            //{
            //    IEngineEditor m_engineEditor = new EngineEditorClass();
            //    IEngineEditTask currentTask = m_engineEditor.CurrentTask;

            //    Control c = Control.FromHandle((System.IntPtr)(m_Application as IFramework).MapControl.hWnd);
            //    if ((m_Application as IFramework).Tool != null && m_engineEditor.EditState == esriEngineEditState.esriEngineStateEditing)
            //    {
            //        switch (currentTask.UniqueName)
            //        {
            //            case "ControlToolsEditing_CreateNewFeatureTask":
            //                if (((ICommand)(m_Application as IFramework).Tool).Name == "ControlToolsEditing_Sketch")
            //                {

            //                    this.sketch_ContextMenuStrip.Opening += delegate(object sender, CancelEventArgs e)
            //                    {
            //                        SetContextMenuItemEnable(((ContextMenuStrip)sender).Items, m_Application);
            //                    };

            //                    this.sketch_ContextMenuStrip.Show(c, X, Y);
            //                    return;
            //                }
            //                else if (((ICommand)(m_Application as IFramework).Tool).Name == "ControlToolsEditing_Edit")
            //                {
            //                    ((IEngineEditSketch)m_engineEditor).SetEditLocation(X, Y);
            //                    this.edit_ContextMenuStrip.Opening += delegate(object sender, CancelEventArgs e)
            //                    {
            //                        SetContextMenuItemEnable(((ContextMenuStrip)sender).Items, m_Application);
            //                    };
            //                    edit_ContextMenuStrip.Show(c, X, Y);
            //                    return;
            //                }
            //                break;
            //            case "ControlToolsEditing_ModifyFeatureTask":
            //                ((IEngineEditSketch)m_engineEditor).SetEditLocation(X, Y);
            //                this.vertex_ContextMenuStrip.Opening += delegate(object sender, CancelEventArgs e)
            //                {
            //                    SetContextMenuItemEnable(((ContextMenuStrip)sender).Items, m_Application);
            //                };
            //                vertex_ContextMenuStrip.Show(c, X, Y);
            //                return;
            //            default:
            //                ((IEngineEditSketch)m_engineEditor).SetEditLocation(X, Y);
            //                this.edit_ContextMenuStrip.Opening += delegate(object sender, CancelEventArgs e)
            //                {
            //                    SetContextMenuItemEnable(((ContextMenuStrip)sender).Items, m_Application);
            //                };
            //                edit_ContextMenuStrip.Show(c, X, Y);
            //                return;
            //        }
            //    }
            //    this.map_ContextMenuStrip.Opening += delegate(object sender, CancelEventArgs e)
            //    {
            //        SetContextMenuItemEnable(((ContextMenuStrip)sender).Items, m_Application);
            //    };
            //    this.map_ContextMenuStrip.Show(c, X, Y);
            //}
            //else
            //{
            //    this.page_ContextMenuStrip.Opening += delegate(object sender, CancelEventArgs e)
            //    {
            //        SetContextMenuItemEnable(((ContextMenuStrip)sender).Items, m_Application);
            //    };
            //    Control c = Control.FromHandle((System.IntPtr)(m_Application as IFramework).PageLayoutControl.hWnd);
            //    page_ContextMenuStrip.Show(c, X, Y);
            //}
        }

        private void SetContextMenuItemEnable(ToolStripItemCollection tsic, IApplication pApplication)
        {
            foreach (ToolStripItem tsi in tsic)
            {
                if (tsi is ToolStripMenuItem)
                {
                    ToolStripMenuItem tsmi = tsi as ToolStripMenuItem;
                    if (tsmi.DropDownItems.Count > 0)
                        SetContextMenuItemEnable(tsmi.DropDownItems, pApplication);
                    else
                    {
                        if (tsmi.Tag != null && tsmi.Tag is ICommand)
                        {
                            ICommand pCommand = tsmi.Tag as ICommand;
                            pCommand.OnCreate(pApplication);
                            tsmi.Checked = pCommand.Checked;
                            tsmi.Enabled = pCommand.Enabled;

                            #region added by sheng at 2012-02-9 使得地图或者布局上的右键菜单同样有图标
                            string imageFile = Application.StartupPath + "\\Images\\18x18\\" + pCommand.Caption + ".png";
                            if (System.IO.File.Exists(imageFile))
                            {
                                Image img = Image.FromFile(imageFile);
                                tsmi.Image = img;
                            }
                            #endregion

                        }
                    }
                }
            }
        }

        public void SetDefaultPopupContextMenu(Control pControl)
        {

        }

        public void UpdateContent(ITool pCurrentTool)
        {

        }

        public void UpdateContent(string sToolName)
        {

        }
    }
}

#region
//public void DisplayStatusInfo(enumMessageType messageType, string sInfo)
//{

//}
//public BarStaticItem BarMapPositionItem;
//public BarStaticItem BarMessageItem;
//public BarStaticItem BarPageLayoutPositionItem;
//private IPopupMenu O1001ll1ll01 = new PopupMenuClass();
//private PopupMenu O101O1l1OO00O110O0 = new PopupMenu();
//private PopupMenu O111Oll100l11OlOl00 = new PopupMenu();
//private OnItemClickEventHandler OnItemClickEvent;
#endregion